﻿using System;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;

namespace TigerCapture.Core.Services
{
    public static class ServiceProvider
    {
        public static void LaunchFile(ProcessStartInfo StartInfo)
        {
            try { Process.Start(StartInfo.FileName); }
            catch (Win32Exception e) when (e.NativeErrorCode == 2)
            {
                MessageBox.Show($"Could not find file: {StartInfo.FileName}");
            }
            catch (Exception e)
            {
                MessageBox.Show($"Could not open file: {StartInfo.FileName}\n\n\n{e}");
            }
        }

        public static bool FileExists(string FileName)
        {
            return File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, FileName));
        }
    }
}
